package com.isoft.controller;

import com.isoft.pojo.dto.PageQueryClassifiedFieldsDTO;
import com.isoft.pojo.vo.ClassifiedFieldsVO;
import com.isoft.result.PageResult;
import com.isoft.result.Result;
import com.isoft.service.ClassifiedFieldsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "数据分级分类管理接口")
@RestController
@Slf4j
@RequestMapping("/admin/classified-fields")

public class ClassifiedFieldsController {
    @Autowired
    private ClassifiedFieldsService classifiedFieldsService;

    /**
     * 分页查询数据分级分类列表
     * @param pageQueryClassifiedFieldsDTO
     * @return
     */
    @Operation(summary = "获取数据分级分类列表")
    @GetMapping
    public Result<PageResult> pageClassifiedFields(@Valid @ParameterObject PageQueryClassifiedFieldsDTO pageQueryClassifiedFieldsDTO){
        log.info("获取数据分级分类列表，参数：{}",pageQueryClassifiedFieldsDTO);
        PageResult<ClassifiedFieldsVO> pageResult = classifiedFieldsService.pageClassifiedFields(pageQueryClassifiedFieldsDTO);
        return Result.success(pageResult);
    }

}
